<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

require_once 'sql_helper.class.php';

class WordFilter
{
    public static function filter($chatroom_text)
    {
        $statement = "SELECT * FROM `C-dev`.WORDFILTER WHERE MATCH(wordfilter_text) AGAINST('$chatroom_text');";
        
        $rs = SQLHelper::executeQuerry($statement);

        $modified_text = $chatroom_text;
        
        while ($row = mysql_fetch_array($rs)) {
            $bad_word = $row[1]."";
            $modified_text = str_ireplace($bad_word, "******", $modified_text);
        }
        
        return $modified_text;
    }
}